cmake_minimum_required(VERSION 3.20)

project(demo)

#用于subdir测试
set(nickname handsomeboy)
set(INCLUDE_PATH ${PROJECT_SOURCE_DIR}/include)
set(LIB2_OUTPATH ${PROJECT_SOURCE_DIR}/libout2)

add_subdirectory(libsrc2)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/libout1)

aux_source_directory(libsrc1 LIBSRC)

add_library(libs STATIC ${LIBSRC})

add_executable(main main.cpp)

#include_directories(include)
#子目录下cmakelists.txt都会包含该include头文件路径
#使用target_include_directories可以优化编译流程
target_include_directories(main PRIVATE include)
target_include_directories(libs PRIVATE include)

find_library(libs2 src2)
#target_include_directories(libs2 PRIVATE include)

target_link_libraries(main libs libs2)